package com.dc.free.controller.charity;

import com.dc.free.controller.BaseController;
import com.dc.free.db.service.CGoodsService;
import com.jfinal.kit.StrKit;

public class GoodsController extends BaseController {

	public void list() {
		int pageNumber = getParaToInt("page_number", 1);
		int pageSize = getParaToInt("page_size", 20);
		String name = getPara("name");
		String actionId = data.getString("actionId");
		
		if(StrKit.isBlank(name)) {
			renderStatus(CGoodsService.listWithBidding(actionId, pageNumber, pageSize));
			return;
		}
		
		renderStatus(CGoodsService.listWithBidding(actionId, name, pageNumber, pageSize));
	}
	
	public void getGoodsWithBiddingMax() {
		String actionId = data.getString("actionId");
		renderStatus(CGoodsService.getGoodsWithBiddingMax(actionId, getPara("id")));
	}
	
	public void names() {
		String name = getPara("name");
		String actionId = data.getString("actionId");
		renderStatus(CGoodsService.names(name, actionId));
	}
}
